package net.sf.calibur.ai.bt;

import java.util.Iterator;
import java.util.Stack;

import net.sf.calibur.ai.bt.composite.SelectorNode;
import net.sf.calibur.ai.bt.composite.SequenceNode;


public class BehaviorTreeTraveler {
	private static long TICK = 0;
	
	public void travel(BehaviorContext context) {
		long tick = TICK ++;
		
		BTNode root = context.getRoot();
		root.perform();
		
	}

	public static void main(String[] args) throws Exception {
		SequenceNode root = new SequenceNode(null);
		
		// ----
		BTNode child1 = new SequenceNode(root);
		root.addChild(child1);
		
		BTNode child2 = new SelectorNode(root); 
		root.addChild(child2);
		
		BTNode child3 = new SelectorNode(root); 
		root.addChild(child3);
		
		// ----
		child1.addChild(new ActionNode(child1, "action1"));
		
		child2.addChild(new ActionNode(child2, "action2"));
		
		child3.addChild(new ActionNode(child3, "action3"));
		
		BehaviorTreeTraveler trav = new BehaviorTreeTraveler();
		trav.travel(new BehaviorContext(root));
	}
}
